import os
from flask import Flask, send_from_directory

# 静态文件目录
STATIC_FOLDER = 'dist/'
STATIC_ASSETS_FOLDER = 'dist/assets'

# Flask 实例
app = Flask(__name__, static_folder=STATIC_FOLDER)


@app.route('/')
def index():
    # 重定向到Vue应用的入口文件
    return send_from_directory(STATIC_FOLDER, 'index.html')


@app.route('/assets/<path:path>')
def static_proxy(path):
    return send_from_directory(STATIC_ASSETS_FOLDER, path)


if __name__ == '__main__':
    app.run(host="0.0.0.0", debug=True)
